package com.example.user.constants;

import com.example.framework.common.exception.ServiceException;
import com.example.framework.common.exception.enums.GlobalErrorCodeConstants;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum LoginTypeEnum {

    BY_PASSWORD("pwd"),
    BY_CODE("code");

    private final String type;

    public static LoginTypeEnum get(String type) {
        LoginTypeEnum[] loginTypeEnums = LoginTypeEnum.values();
        for (LoginTypeEnum loginTypeEnum : loginTypeEnums) {
            if (loginTypeEnum.type.equals(type)) {
                return loginTypeEnum;
            }
        }
        throw ServiceException.of(GlobalErrorCodeConstants.NOT_IMPLEMENTED);
    }
}
